<template>
<div class="w-full flex flex-col">
  <div class="flex h-8 flex-row-reverse items-center pt-1.5 pb-1.5">
    <el-button  @click="setUser" link type="primary">设置执行用户</el-button>
  </div>
  <div class="pt-1.5 pb-1.5">
    <el-input v-model="user" type="textarea" disabled placeholder="执行用户"></el-input>
  </div>
  <SelectUserCondition @callback="setData" ref="selectUserConditionRef"></SelectUserCondition>

</div>
</template>

<script setup lang="ts">
import SelectUserCondition from './SelectUserCondition.vue'
import {ref, watch} from "vue";
import {formatUserData} from "/@/views/flow/design/component/property-panel/ts/TaskExecute";
const props = defineProps({
  modelValue: Object,
})
const emit = defineEmits(['update:modelValue'])
const selectUserConditionRef = ref()
const data = ref()
const user = ref('')
const setUser = () =>{
  selectUserConditionRef.value.init(props.modelValue)
}
const setData = (data,value) => {
  emit('update:modelValue',data)

}
watch(()=> props.modelValue,(newValue)=>{
  user.value = formatUserData(newValue)
},{deep: true,immediate: true})
</script>

<style scoped>

</style>